=begin
  这个文件用于读SQL导出文件中字段片段，以便创造一个不出错的数组
  Usage: ruby gen-sql-fields.rb > /tmp/err #然后再对应的程序中读入后修改即可

  sql-fields例如，可直接从SQL DUMP文件中得到：

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID',
  `order_id` varchar(32) NOT NULL COMMENT '订单号',
  KEY `coupon_id` (`coupon_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单表';

=end

output = "["
lines = IO.readlines('sql-fields')
lines.each do |line|
  field = line.split('`')[0]
  output += " '#{field}', " if !field.to_s.empty?
end
output += "]"
puts output
